-
-
Notifications
You must be signed in to change notification settings - Fork 233
Angular Resource Plugin #2423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular Resource Plugin #2423
Conversation
- Updated `openapi-ts.config.ts` to configure Angular client plugin with error handling option. - Modified `app.component.html` to use a demo component for displaying pet information. - Refactored `app.component.ts` to remove direct API calls and integrate with the new demo component. - Enhanced `app.config.ts` to provide the Hey API client for dependency injection. - Improved error handling in client utilities and response processing. - Added new demo component with HTML and CSS for displaying pet information and error messages. - Updated client generation scripts to support new error handling and response structures. - Refactored HTTP client usage to support custom injectors and improved error response handling.
…onBodySerializer import
…ration - Introduced `types.gen.ts` for TypeScript types related to API requests and responses. - Created `sdk.gen.ts` to define SDK functions for interacting with the API. - Added `schemas.gen.ts` to define data schemas for various entities like Order, User, Pet, etc. - Implemented `index.ts` to export SDK and types for easier access. - Developed `main.ts` and `main.server.ts` for bootstrapping the Angular application. - Set up server-side rendering with Express in `server.ts`. - Included basic HTML structure in `index.html`. - Configured TypeScript settings in `tsconfig` files for application and testing. - Added global styles in `styles.css`.
|
🦋 Changeset detectedLatest commit: 554e9a6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@max-scopp is attempting to deploy a commit to the Hey API Team on Vercel. A member of the Team first needs to authorize it. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2423 +/- ##
==========================================
- Coverage 22.84% 22.59% -0.25%
==========================================
Files 334 336 +2
Lines 32948 33366 +418
Branches 1309 1309
==========================================
+ Hits 7526 7540 +14
- Misses 25413 25817 +404
Partials 9 9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
commit: |
- Added `httpResource` and `httpRequest` companion plugin handlers to generate Angular services and functions for API operations. - Introduced `PetResources`, `StoreResources`, and `UserResources` classes for managing pet store operations. - Enhanced configuration options for HTTP resources and requests, allowing customization of class and method names. - Generated TypeScript definitions for Angular HTTP resource and request options. - Updated plugin handler to conditionally enable HTTP resource generation based on configuration.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
// Set default classNameBuilder based on client type | ||
if (plugin.config.classNameBuilder === '{{name}}') { | ||
if (plugin.config.client === '@hey-api/client-angular') { | ||
plugin.config.classNameBuilder = '{{name}}Service'; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't have a custom class name builder and you use the angular client and want to create classes with asClass: true
, suffix the classes with "Service" to avoid potential clashing names of the same interface and controller/class name. I did this because in the Pet store, this would result in the class and endpoints for Pet
, as well, as the interface for one Pet's response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might need to come back to this one at some point. It feels dirty. I have no problem with accepting it for now but maybe we want to add some comments around why it's done that way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I'm also conflicted about this, for now the Service
suffix is still widely accepted by Angular devs, but they too would prefer to move away from this pattern
docs/openapi-ts/clients/angular.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to myself: update this later
…max-scopp/openapi-ts into feature/angular-resource-plugin
Builds on top of #2422